package com.wanshi.entity;

import com.wanshi.utils.Constants;

public class Result {

    private Integer code;


    private String msg;

    private Object data;

    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(int code, String msg) {
        this.code =code;
        this.msg = msg;

    }

    public Result() {
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static Result ok(){
        return new Result(Constants.SUCCESS,"成功");
    }

    public static Result error(){
        return new Result(Constants.ERROR,"失败");
    }

    public static Result error(int code, String message){
        return new Result(code,message);
    }

    public static Result ok(Object object){
        return new Result(Constants.SUCCESS,"成功",object);
    }
}
